package com.whlilong.jxc.view;

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.MouseTrackListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Table;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.part.ViewPart;

import com.whlilong.jxc.constants.IAppConstants;
import com.whlilong.jxc.input.InBaseCheckEditorInput;
import com.whlilong.jxc.input.PurcharsBookEditorInput;
import com.whlilong.jxc.input.PurcharsSellEditorInput;
import com.whlilong.jxc.sys.CacheImage;
import com.whlilong.jxc.sys.IImageKey;
import com.whlilong.jxc.util.ViewerChange;

/**采购管理视图
 * @author sjy
 *
 */
public class PurchasManagerView extends ViewPart implements ISelectionListener{
	private Color bg = new Color(Display.getCurrent(), 0xe9, 0xf0, 0xf9);
	private final IWorkbenchWindow window = PlatformUI.getWorkbench()
	.getActiveWorkbenchWindow();

	public PurchasManagerView() {
		// TODO Auto-generated constructor stub
	}

	@Override
	public void createPartControl(Composite parent) {
		// TODO Auto-generated method stub
		createContent(parent);
		PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
		.addSelectionListener(this);
	}

	private void createContent(Composite parent) {
		// TODO Auto-generated method stub
		Composite composite = new Composite(parent, SWT.NONE);
		GridLayout layout = new GridLayout();
		layout.numColumns = 7;
		layout.marginTop = 10;
		layout.marginBottom = 10;
		layout.marginRight = 10;
		layout.marginLeft = 10;
		layout.makeColumnsEqualWidth = false;

		composite.setLayout(layout);
		composite.setBackgroundImage(CacheImage.getINSTANCE().getImage(
				IAppConstants.APPLICATION_ID, IImageKey.FUNCTIONS_BG));
		GridData gd = new GridData(GridData.CENTER);
		gd.horizontalIndent = 10;
		gd.verticalIndent = 10;
		gd.widthHint = 120;
		gd.heightHint = 70;
		gd.verticalSpan = 3;

		final CLabel ghht = new CLabel(composite, SWT.NONE);
		ghht.setText("货商供货合同");
		ghht.setImage(CacheImage.getINSTANCE().getImage(
				IAppConstants.APPLICATION_ID, IImageKey.ghht));
		ghht.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
//		ghht.setBackgroundImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.BUTTON_BG));
		ghht.setLayoutData(gd);
		
		ghht.addMouseTrackListener(new MouseTrackListener(){

			@Override
			public void mouseEnter(MouseEvent e) {
				// TODO Auto-generated method stub
				ghht.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
			}

			@Override
			public void mouseExit(MouseEvent e) {
				// TODO Auto-generated method stub
				ghht.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
			}

			@Override
			public void mouseHover(MouseEvent e) {
				// TODO Auto-generated method stub
				ghht.setToolTipText(ghht.getText());
			}
			
		});
		ghht.addMouseListener(new MouseListener(){

			@Override
			public void mouseDoubleClick(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void mouseDown(MouseEvent e) {
				// TODO Auto-generated method stub
				MessageDialog.openInformation(null, ghht.getText(), "测试Label行为！");
			}

			@Override
			public void mouseUp(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
		});
		
		final CLabel line = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 90;
		gd.heightHint = 300;
		gd.horizontalIndent = 0;
		gd.verticalSpan = 5;
		line.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.line));
		line.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		line.setLayoutData(gd);
		
		final CLabel bhd = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 80;
		gd.heightHint = 50;
		bhd.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.bhd));
		bhd.setText("补货单");
		bhd.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		bhd.setLayoutData(gd);
		bhd.addMouseTrackListener(new MouseTrackListener(){

			@Override
			public void mouseEnter(MouseEvent e) {
				// TODO Auto-generated method stub
				bhd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
			}

			@Override
			public void mouseExit(MouseEvent e) {
				// TODO Auto-generated method stub
				bhd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
			}

			@Override
			public void mouseHover(MouseEvent e) {
				// TODO Auto-generated method stub
				bhd.setToolTipText(bhd.getText());
			}
			
		});
		bhd.addMouseListener(new MouseListener(){

			@Override
			public void mouseDoubleClick(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void mouseDown(MouseEvent e) {
				// TODO Auto-generated method stub
				MessageDialog.openInformation(null, "提示", "测试Label行为！");
			}

			@Override
			public void mouseUp(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
		});
		
		final CLabel empty = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 40;
		gd.heightHint = 50;
		empty.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		empty.setLayoutData(gd);
		
		final CLabel rkd = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 100;
		gd.heightHint = 50;
		rkd.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.rkd));
		rkd.setText("入库单");
		rkd.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		rkd.setLayoutData(gd);
		rkd.addMouseTrackListener(new MouseTrackListener(){

			@Override
			public void mouseEnter(MouseEvent e) {
				// TODO Auto-generated method stub
				rkd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
			}

			@Override
			public void mouseExit(MouseEvent e) {
				// TODO Auto-generated method stub
				rkd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
			}

			@Override
			public void mouseHover(MouseEvent e) {
				// TODO Auto-generated method stub
				rkd.setToolTipText(rkd.getText());
			}
			
		});
		rkd.addMouseListener(new MouseListener(){

			@Override
			public void mouseDoubleClick(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void mouseDown(MouseEvent e) {
				// TODO Auto-generated method stub
				MessageDialog.openInformation(null, "提示", "测试Label行为！");
			}

			@Override
			public void mouseUp(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
		});
		
		final CLabel line2 = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 110;
		gd.heightHint = 300;
		gd.verticalSpan = 5;
		line2.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.line2));
		line2.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		line2.setLayoutData(gd);
		
		final CLabel gxjsd = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 120;
		gd.heightHint = 50;
		gxjsd.setText("购销结算单");
		gxjsd.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.gxjsd));
		gxjsd.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		gxjsd.setLayoutData(gd);
		gxjsd.addMouseTrackListener(new MouseTrackListener(){

			@Override
			public void mouseEnter(MouseEvent e) {
				// TODO Auto-generated method stub
				gxjsd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
			}

			@Override
			public void mouseExit(MouseEvent e) {
				// TODO Auto-generated method stub
				gxjsd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
			}

			@Override
			public void mouseHover(MouseEvent e) {
				// TODO Auto-generated method stub
				gxjsd.setToolTipText(gxjsd.getText());
			}
			
		});
		gxjsd.addMouseListener(new MouseListener(){

			@Override
			public void mouseDoubleClick(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void mouseDown(MouseEvent e) {
				PurcharsSellEditorInput input = new PurcharsSellEditorInput();
				try {
					window.getActivePage().savePerspective();
					window.getActivePage().close();
					window.openPage(IAppConstants.editor_perspective, null);
					window.getShell().setMaximized(true);
					window.getActivePage().openEditor(input,
							IAppConstants.pucharsSellEditor_id, true);
				} catch (PartInitException e1) {
					e1.printStackTrace();
				} catch (WorkbenchException e2) {
					e2.printStackTrace();
				}
			}

			@Override
			public void mouseUp(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
		});
		
		final CLabel vline = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 120;
		gd.heightHint = 50;
		gd.horizontalSpan = 2;
		vline.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.vline));
		vline.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		vline.setLayoutData(gd);
		
		final CLabel v2line = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 120;
		gd.heightHint = 50;
		v2line.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.vline));
		v2line.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		v2line.setLayoutData(gd);
		
		final CLabel empty2 = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 120;
		gd.heightHint = 50;
		empty2.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		empty2.setLayoutData(gd);
		
		final CLabel cgdhd = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 120;
		gd.heightHint = 70;
		cgdhd.setText("采购订货单");
		cgdhd.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.cgdhd));
		cgdhd.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		cgdhd.setLayoutData(gd);
		cgdhd.addMouseTrackListener(new MouseTrackListener(){

			@Override
			public void mouseEnter(MouseEvent e) {
				// TODO Auto-generated method stub
				cgdhd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
			}

			@Override
			public void mouseExit(MouseEvent e) {
				// TODO Auto-generated method stub
				cgdhd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
			}

			@Override
			public void mouseHover(MouseEvent e) {
				// TODO Auto-generated method stub
				cgdhd.setToolTipText(cgdhd.getText());
			}
			
		});
		cgdhd.addMouseListener(new MouseListener(){

			@Override
			public void mouseDoubleClick(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void mouseDown(MouseEvent e) {
				// TODO Auto-generated method stub
				PurcharsBookEditorInput input = new PurcharsBookEditorInput();
				try {
					window.getActivePage().savePerspective();
					window.getActivePage().close();
					window.openPage(IAppConstants.editor_perspective, null);
					window.getShell().setMaximized(true);
					window.getActivePage().openEditor(input,
							IAppConstants.pucharsBookEditor_id, true);
				} catch (PartInitException e1) {
					e1.printStackTrace();
				} catch (WorkbenchException e2) {
					e2.printStackTrace();
				}
			}

			@Override
			public void mouseUp(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
		});
		
		final CLabel h2line = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 70;
		gd.heightHint = 70;
		gd.horizontalIndent = 0;
		h2line.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.hline));
		h2line.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		h2line.setLayoutData(gd);
		
		final CLabel rkysd = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 120;
		gd.heightHint = 70;
		rkysd.setText("入库验收单");
		rkysd.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.rkysd));
		rkysd.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		rkysd.setLayoutData(gd);
		rkysd.addMouseTrackListener(new MouseTrackListener(){

			@Override
			public void mouseEnter(MouseEvent e) {
				// TODO Auto-generated method stub
				rkysd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
			}

			@Override
			public void mouseExit(MouseEvent e) {
				// TODO Auto-generated method stub
				rkysd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
			}

			@Override
			public void mouseHover(MouseEvent e) {
				// TODO Auto-generated method stub
				rkysd.setToolTipText(rkysd.getText());
			}
			
		});
		rkysd.addMouseListener(new MouseListener(){

			@Override
			public void mouseDoubleClick(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void mouseDown(MouseEvent e) {
				InBaseCheckEditorInput input = new InBaseCheckEditorInput();
				try {
					window.getActivePage().savePerspective();
					window.getActivePage().close();
					window.openPage(IAppConstants.editor_perspective, null);
					window.getShell().setMaximized(true);
					window.getActivePage().openEditor(input,
							IAppConstants.InBaseCheckEditor_id, true);
				} catch (PartInitException e1) {
					e1.printStackTrace();
				} catch (WorkbenchException e2) {
					e2.printStackTrace();
				}
			}

			@Override
			public void mouseUp(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
		});
		
		final CLabel dxjsd = new CLabel(composite, SWT.NONE);
		dxjsd.setText("代销结算单");
		dxjsd.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.dxjsd));
		dxjsd.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		dxjsd.setLayoutData(gd);
		dxjsd.addMouseTrackListener(new MouseTrackListener(){

			@Override
			public void mouseEnter(MouseEvent e) {
				// TODO Auto-generated method stub
				dxjsd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
			}

			@Override
			public void mouseExit(MouseEvent e) {
				// TODO Auto-generated method stub
				dxjsd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
			}

			@Override
			public void mouseHover(MouseEvent e) {
				// TODO Auto-generated method stub
				dxjsd.setToolTipText(dxjsd.getText());
			}
			
		});
		dxjsd.addMouseListener(new MouseListener(){

			@Override
			public void mouseDoubleClick(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void mouseDown(MouseEvent e) {
				// TODO Auto-generated method stub
				MessageDialog.openInformation(null, "提示", "测试Label行为！");
			}

			@Override
			public void mouseUp(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
		});
		
		final CLabel cgxjd = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 120;
		gd.heightHint = 120;
		gd.verticalSpan = 2;
		cgxjd.setText("采购询价单");
		cgxjd.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.cgxjd));
		cgxjd.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		cgxjd.setLayoutData(gd);
		cgxjd.addMouseTrackListener(new MouseTrackListener(){

			@Override
			public void mouseEnter(MouseEvent e) {
				// TODO Auto-generated method stub
				cgxjd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
			}

			@Override
			public void mouseExit(MouseEvent e) {
				// TODO Auto-generated method stub
				cgxjd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
			}

			@Override
			public void mouseHover(MouseEvent e) {
				// TODO Auto-generated method stub
				cgxjd.setToolTipText(cgxjd.getText());
			}
			
		});
		cgxjd.addMouseListener(new MouseListener(){

			@Override
			public void mouseDoubleClick(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void mouseDown(MouseEvent e) {
				// TODO Auto-generated method stub
				MessageDialog.openInformation(null, "提示", "测试Label行为！");
			}

			@Override
			public void mouseUp(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
		});
		
		final CLabel v3line = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 120;
		gd.heightHint = 50;
		gd.horizontalSpan = 2;
		v3line.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.vline));
		v3line.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		v3line.setLayoutData(gd);
		
		final CLabel v4line = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 120;
		gd.heightHint = 50;
		v4line.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.vline));
		v4line.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		v4line.setLayoutData(gd);
		
		final CLabel empty3 = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 120;
		gd.heightHint = 50;
		empty3.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		empty3.setLayoutData(gd);
		
		
		final CLabel jjtzd = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 120;
		gd.heightHint = 70;
		jjtzd.setText("进价调整单");
		jjtzd.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.jjtzd));
		jjtzd.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		jjtzd.setLayoutData(gd);
		jjtzd.addMouseTrackListener(new MouseTrackListener(){

			@Override
			public void mouseEnter(MouseEvent e) {
				// TODO Auto-generated method stub
				jjtzd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
			}

			@Override
			public void mouseExit(MouseEvent e) {
				// TODO Auto-generated method stub
				jjtzd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
			}

			@Override
			public void mouseHover(MouseEvent e) {
				// TODO Auto-generated method stub
				jjtzd.setToolTipText(jjtzd.getText());
			}
			
		});
		jjtzd.addMouseListener(new MouseListener(){

			@Override
			public void mouseDoubleClick(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void mouseDown(MouseEvent e) {
				// TODO Auto-generated method stub
				MessageDialog.openInformation(null, "提示", "测试Label行为！");
			}

			@Override
			public void mouseUp(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
		});
		
		final CLabel empty4 = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 70;
		gd.heightHint = 70;
		empty4.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		empty4.setLayoutData(gd);
		
		final CLabel cgthd = new CLabel(composite, SWT.NONE);
		gd = new GridData(GridData.CENTER);
		gd.widthHint = 120;
		gd.heightHint = 70;
		cgthd.setText("采购退货单");
		cgthd.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.cgthd));
		cgthd.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		cgthd.setLayoutData(gd);
		cgthd.addMouseTrackListener(new MouseTrackListener(){

			@Override
			public void mouseEnter(MouseEvent e) {
				// TODO Auto-generated method stub
				cgthd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
			}

			@Override
			public void mouseExit(MouseEvent e) {
				// TODO Auto-generated method stub
				cgthd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
			}

			@Override
			public void mouseHover(MouseEvent e) {
				// TODO Auto-generated method stub
				cgthd.setToolTipText(cgthd.getText());
			}
			
		});
		cgthd.addMouseListener(new MouseListener(){

			@Override
			public void mouseDoubleClick(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void mouseDown(MouseEvent e) {
				// TODO Auto-generated method stub
				MessageDialog.openInformation(null, "提示", "测试Label行为！");
			}

			@Override
			public void mouseUp(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
		});
		
		final CLabel lyjsd = new CLabel(composite, SWT.NONE);
		lyjsd.setText("联营结算单");
		lyjsd.setImage(CacheImage.getINSTANCE().getImage(IAppConstants.APPLICATION_ID, IImageKey.lyjsd));
		lyjsd.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		lyjsd.setLayoutData(gd);
		lyjsd.addMouseTrackListener(new MouseTrackListener(){

			@Override
			public void mouseEnter(MouseEvent e) {
				// TODO Auto-generated method stub
				lyjsd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
			}

			@Override
			public void mouseExit(MouseEvent e) {
				// TODO Auto-generated method stub
				lyjsd.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
			}

			@Override
			public void mouseHover(MouseEvent e) {
				// TODO Auto-generated method stub
				lyjsd.setToolTipText(lyjsd.getText());
			}
			
		});
		lyjsd.addMouseListener(new MouseListener(){

			@Override
			public void mouseDoubleClick(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void mouseDown(MouseEvent e) {
				// TODO Auto-generated method stub
				MessageDialog.openInformation(null, "提示", "测试Label行为！");
			}

			@Override
			public void mouseUp(MouseEvent e) {
				// TODO Auto-generated method stub
				
			}
			
		});
		
	}

	@Override
	public void setFocus() {
		// TODO Auto-generated method stub

	}

	@Override
	public void selectionChanged(IWorkbenchPart part, ISelection selection) {
		if (!selection.isEmpty()) {
			IViewPart vp = getViewSite().getPage().findView(
					IAppConstants.systemManagerview_id);

			Table table = ((SystemManagerView) vp).getTableViewer().getTable();
			ViewerChange.getInstance().refreshView(table);
		}	
	}
	


}
